package com.lin.chapter5;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;

import java.nio.charset.Charset;

public class ByteBufCopie {
	public static void main(String[] args) {
		Charset charset = Charset.forName("UTF-8");
		ByteBuf byteBuf = Unpooled.copiedBuffer("Netty in Action rocks!", charset);
		ByteBuf copy = byteBuf.copy(0, 15);
		System.out.println(copy.toString(charset));
		byteBuf.setByte(0, (byte)'J');
		assert byteBuf.getByte(0) != copy.getByte(0);
	}
}
